package day01;

/**
 * @author feng
 * @Date 2021/9/22 7:24
 */
public class DeekOfCards {
    public static void main(String[] args) {

        int[] deck = new int[52];
        String[] suits = {"黑桃","红桃","方块","梅花"};
        String[] ranks = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
        //初始化牌
        for (int i = 0; i <deck.length ; i++) {
            deck[i]=i;
        }
        // 打乱牌的顺序
        for (int i = 0; i <deck.length ; i++) {
            // 产生一个0·51的下标
             int index = (int) (Math.random()*deck.length);
             int tmp = deck[i];
             deck[i] = deck[index];
             deck[index] = tmp;
        }
        // 显示输出的前4张牌
        for (int i = 0; i < 4 ; i++) {
            String sult = suits[deck[i]/13];
            String rank = ranks[deck[i]/13];
            System.out.println(sult+""+rank);
        }


    }
}
